﻿/*	
	stencil - action script 3 isometric game engine.

	Copyright (c) 2010 Max Zhuravkov, All Rights Reserved.

	Permission is hereby granted, free of charge, to any person obtaining a copy of
	this software and associated documentation files (the "Software"), to deal in
	the Software without restriction, including without limitation the rights to
	use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
	of the Software, and to permit persons to whom the Software is furnished to do
	so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all
	copies or substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
	SOFTWARE.
*/
package stencil.core.ui {
	
	import flash.utils.Dictionary;
	
	/**
	 * Defines keycodes and key name constants.
	 * 
	 * @author	Max Zhuravkov
	 */
	public final class KeyboardKeys {
		
		/**
		 * Keycodes.
		 */
		
		public static const ESC:uint = 27;
		
		public static const SHIFT:uint = 16;
		
		public static const CTRL:uint = 17;
		
		public static const TAB:uint = 9;
		
		public static const ENTER:uint = 13;
		
		public static const BACKSPACE:uint = 8;
		
		public static const PAGE_UP:uint = 33;
		
		public static const PAGE_DOWN:uint = 34;
		
		public static const END:uint = 35;
		
		public static const HOME:uint = 36;
		
		public static const INSERT:uint = 45;
		
		public static const DELETE:uint = 46;
		
		public static const SPACE:uint = 32;
		
		public static const CAPS_LOCK:uint = 20;
		
		public static const NUM_LOCK:uint = 144;
		
		public static const PAUSE:uint = 19;
		
		public static const WIN:uint = 91;
		
		public static const COMMAND:uint = 15;
		
		public static const ALTERNATE:uint = 18;
		
		//public static const TAB:uint = 9;
		
	
		public static const F1:uint = 112;
		
		public static const F2:uint = 113;
		
		public static const F3:uint = 114;
		
		public static const F4:uint = 115;
		
		public static const F5:uint = 116;
		
		public static const F6:uint = 117;
		
		public static const F7:uint = 118;
		
		public static const F8:uint = 119;
		
		public static const F9:uint = 120;
		
		public static const F10:uint = 121;
		
		public static const F11:uint = 122;
		
		public static const F12:uint = 123;
		
		
		public static const Q:uint = 81;
		
		public static const W:uint = 87;
		
		public static const E:uint = 69;
		
		public static const R:uint = 82;
		
		public static const T:uint = 84;
		
		public static const Y:uint = 89;
		
		public static const U:uint = 85;
		
		public static const I:uint = 73;
		
		public static const O:uint = 79;
		
		public static const P:uint = 80;
		
		public static const A:uint = 65;
		
		public static const S:uint = 83;
		
		public static const D:uint = 68;
		
		public static const F:uint = 70;
		
		public static const G:uint = 71;
		
		public static const H:uint = 72;
		
		public static const J:uint = 74;
		
		public static const K:uint = 75;
		
		public static const L:uint = 76;
		
		public static const Z:uint = 90;
		
		public static const X:uint = 88;
		
		public static const C:uint = 67;
		
		public static const V:uint = 86;
		
		public static const B:uint = 66;
	
		public static const N:uint = 78;
		
		public static const M:uint = 77;
		
		
		public static const NUMBER_1:uint = 49;
		
		public static const NUMBER_2:uint = 50;
	
		public static const NUMBER_3:uint = 51;
		
		public static const NUMBER_4:uint = 52;
		
		public static const NUMBER_5:uint = 53;
		
		public static const NUMBER_6:uint = 54;
		
		public static const NUMBER_7:uint = 55;
		
		public static const NUMBER_8:uint = 56;
		
		public static const NUMBER_9:uint = 57;
		
		public static const NUMBER_0:uint = 48;
		
		
		public static const NUMPAD_DECIMAL:uint = 110;
		
		public static const NUMPAD_DIVIDE:uint = 111;
		
		public static const NUMPAD_SUBSTRACT:uint = 109;
		
		public static const NUMPAD_MULTIPLY:uint = 106;
		
		public static const NUMPAD_ADD:uint = 107;
		
		public static const NUMPAD_1:uint = 97;
		
		public static const NUMPAD_2:uint = 98;
		
		public static const NUMPAD_3:uint = 99;
		
		public static const NUMPAD_4:uint = 100;
		
		public static const NUMPAD_5:uint = 101;
		
		public static const NUMPAD_6:uint = 102;
		
		public static const NUMPAD_7:uint = 103;
		
		public static const NUMPAD_8:uint = 104;
		
		public static const NUMPAD_9:uint = 105;
		
		public static const NUMPAD_0:uint = 96;
		
		
		public static const UP:uint = 38;
		
		public static const DOWN:uint = 40;
		
		public static const RIGHT:uint = 39;
		
		public static const LEFT:uint = 37;
		
		
		public static const MINUS:uint = 189;
		
		public static const EQUAL:uint = 187;
		
		public static const COMMA:uint = 188;
		
		public static const PERIOD:uint = 190;
		
		public static const BACKSLASH:uint = 191;
		
		public static const BACKQUOTE:uint = 192;
		
		public static const SLASH:uint = 220;
		
		public static const SEMICOLON:uint = 186;
		
		public static const QUOTE:uint = 222;
		
		public static const LEFTBRACKET:uint = 219;
		
		public static const RIGHTBRACKET:uint = 221;
		
		/**
		 * Key names.
		 */
		
		public static const RIGHTBRACKET_KEY_NAME:String = "RIGHTBRACKET";
		
		public static const CAPS_LOCK_KEY_NAME:String = "CAPS_LOCK";
		
		public static const DELETE_KEY_NAME:String = "DELETE";
		
		public static const ENTER_KEY_NAME:String = "ENTER";
		
		public static const CTRL_KEY_NAME:String = "CTRL";
		
		public static const MINUS_KEY_NAME:String = "MINUS";
		
		public static const HOME_KEY_NAME:String = "HOME";
		
		public static const PAGE_DOWN_KEY_NAME:String = "PAGE_DOWN";
		
		public static const ESC_KEY_NAME:String = "ESC";
		
		public static const INSERT_KEY_NAME:String = "INSERT";
		
		public static const SHIFT_KEY_NAME:String = "SHIFT";
		
		public static const PAGE_UP_KEY_NAME:String = "PAGE_UP";
		
		public static const END_KEY_NAME:String = "END";
		
		public static const TAB_KEY_NAME:String = "TAB";
		
		public static const SPACE_KEY_NAME:String = "SPACE";
		
		public static const NUM_LOCK_KEY_NAME:String = "NUM_LOCK";
		
		public static const PAUSE_KEY_NAME:String = "PAUSE";
		
		public static const WIN_KEY_NAME:String = "WIN";
		
		public static const COMMAND_KEY_NAME:String = "COMMAND";
		
		public static const ALTERNATE_KEY_NAME:String = "ALTERNATE";
		
	
		public static const F1_KEY_NAME:String = "F1";
		
		public static const F2_KEY_NAME:String = "F2";
		
		public static const F3_KEY_NAME:String = "F3";
		
		public static const F4_KEY_NAME:String = "F4";
		
		public static const F5_KEY_NAME:String = "F5";
		
		public static const F6_KEY_NAME:String = "F6";

		public static const F7_KEY_NAME:String = "F7";
		
		public static const F8_KEY_NAME:String = "F8";
		
		public static const F9_KEY_NAME:String = "F9";
		
		public static const F10_KEY_NAME:String = "F10";
		
		public static const F11_KEY_NAME:String = "F11";
		
		public static const F12_KEY_NAME:String = "F12";
		
		
		public static const A_KEY_NAME:String = "A";
		
		public static const B_KEY_NAME:String = "B";
		
		public static const C_KEY_NAME:String = "C";
		
		public static const D_KEY_NAME:String = "D";
		
		public static const E_KEY_NAME:String = "E";
		
		public static const F_KEY_NAME:String = "F";
		
		public static const G_KEY_NAME:String = "G";
		
		public static const H_KEY_NAME:String = "H";
		
		public static const J_KEY_NAME:String = "J";
		
		public static const I_KEY_NAME:String = "I";
		
		public static const K_KEY_NAME:String = "K";
		
		public static const M_KEY_NAME:String = "M";
		
		public static const L_KEY_NAME:String = "L";
		
		public static const N_KEY_NAME:String = "N";
		
		
		public static const O_KEY_NAME:String = "O";
		
		public static const P_KEY_NAME:String = "P";
		
		public static const Q_KEY_NAME:String = "Q";
		
		public static const R_KEY_NAME:String = "R";
		
		public static const S_KEY_NAME:String = "S";
		
		public static const T_KEY_NAME:String = "T";
		
		public static const V_KEY_NAME:String = "V";
		
		public static const U_KEY_NAME:String = "U";
		
		public static const W_KEY_NAME:String = "W";
		
		public static const X_KEY_NAME:String = "X";
		
		public static const Z_KEY_NAME:String = "Z";
		
		public static const Y_KEY_NAME:String = "Y";
		
		
		public static const NUMBER_1_KEY_NAME:String = "NUMBER_1";
		
		public static const NUMBER_2_KEY_NAME:String = "NUMBER_2";
		
		public static const NUMBER_3_KEY_NAME:String = "NUMBER_3";
		
		public static const NUMBER_4_KEY_NAME:String = "NUMBER_4";
		
		public static const NUMBER_5_KEY_NAME:String = "NUMBER_5";
		
		public static const NUMBER_6_KEY_NAME:String = "NUMBER_6";
		
		public static const NUMBER_7_KEY_NAME:String = "NUMBER_7";
		
		public static const NUMBER_8_KEY_NAME:String = "NUMBER_8";
		
		public static const NUMBER_9_KEY_NAME:String = "NUMBER_9";
		
		public static const NUMBER_0_KEY_NAME:String = "NUMBER_0";
		
		
		public static const NUMPAD_DECIMAL_KEY_NAME:String = "NUMPAD_DECIMICAL";
		
		public static const NUMPAD_SUBSTRACT_KEY_NAME:String = "NUMPAD_SUBSTRACT";
		
		public static const NUMPAD_DIVIDE_KEY_NAME:String = "NUMPAD_DIVIDE";
		
		public static const NUMPAD_MULTIPLY_KEY_NAME:String = "NUMPAD_MULTIPLY";
		
		public static const NUMPAD_ADD_KEY_NAME:String="NUMPAD_ADD";
		
		public static const NUMPAD_1_KEY_NAME:String = "NUMPAD_1";
		
		public static const NUMPAD_2_KEY_NAME:String = "NUMPAD_2";

		public static const NUMPAD_3_KEY_NAME:String = "NUMPAD_3";
		
		public static const NUMPAD_4_KEY_NAME:String = "NUMPAD_4";
		
		public static const NUMPAD_5_KEY_NAME:String = "NUMPAD_5";
		
		public static const NUMPAD_6_KEY_NAME:String = "NUMPAD_6";
		
		public static const NUMPAD_7_KEY_NAME:String = "NUMPAD_7";
		
		public static const NUMPAD_8_KEY_NAME:String = "NUMPAD_8";
		
		public static const NUMPAD_9_KEY_NAME:String = "NUMPAD_9";
		
		public static const NUMPAD_0_KEY_NAME:String = "NUMPAD_0";
		
		
		public static const QUOTE_KEY_NAME:String = "QUOTE";
	
		public static const EQUAL_KEY_NAME:String = "EQUAL";
		
		public static const SLASH_KEY_NAME:String = "SLASH";
		
		public static const SEMICOLON_KEY_NAME:String = "SEMICOLON";
		
		public static const BACKQUOTE_KEY_NAME:String = "BACKQUOTE";
		
		public static const PERIOD_KEY_NAME:String = "PERIOD";
		
		public static const LEFTBRACKET_KEY_NAME:String = "LEFTBRACKET";
		
		public static const COMMA_KEY_NAME:String = "COMMA";
		
		public static const BACKSLASH_KEY_NAME:String = "BACKSLASH";
		
		public static const BACKSPACE_KEY_NAME:String = "BACKSPACE";
		
		
		public static const DOWN_KEY_NAME:String = "DOWN";
		
		public static const UP_KEY_NAME:String = "UP";
		
		public static const RIGHT_KEY_NAME:String = "RIGHT";
		
		public static const LEFT_KEY_NAME:String = "LEFT";
		
		
		private static const _keyCodes:Dictionary = new Dictionary();
		
		private static const _keyNames:Dictionary = new Dictionary();
		
		{
			
			//filling key name-keycode table.
			
			_keyCodes[A_KEY_NAME] = A;
			_keyCodes[B_KEY_NAME] = B;
			_keyCodes[C_KEY_NAME] = C;
			_keyCodes[D_KEY_NAME] = D;
			_keyCodes[E_KEY_NAME] = E;
			_keyCodes[F_KEY_NAME] = F;
			_keyCodes[G_KEY_NAME] = G;
			_keyCodes[H_KEY_NAME] = H;
			_keyCodes[I_KEY_NAME] = I;
			_keyCodes[J_KEY_NAME] = J;
			_keyCodes[K_KEY_NAME] = K;
			_keyCodes[L_KEY_NAME] = L;
			_keyCodes[M_KEY_NAME] = M;
			_keyCodes[N_KEY_NAME] = N;
			_keyCodes[O_KEY_NAME] = O;
			_keyCodes[P_KEY_NAME] = P;
			_keyCodes[Q_KEY_NAME] = Q;
			_keyCodes[P_KEY_NAME] = R;
			_keyCodes[S_KEY_NAME] = S;
			_keyCodes[T_KEY_NAME] = T;
			_keyCodes[V_KEY_NAME] = V;
			_keyCodes[U_KEY_NAME] = U;
			_keyCodes[W_KEY_NAME] = W;
			_keyCodes[X_KEY_NAME] = X;
			_keyCodes[Y_KEY_NAME] = Y;
			_keyCodes[Z_KEY_NAME] = Z;
			
			_keyCodes[NUMBER_1_KEY_NAME] = NUMBER_1;
			_keyCodes[NUMBER_2_KEY_NAME] = NUMBER_2;
			_keyCodes[NUMBER_3_KEY_NAME] = NUMBER_3;
			_keyCodes[NUMBER_4_KEY_NAME] = NUMBER_4;
			_keyCodes[NUMBER_5_KEY_NAME] = NUMBER_5;
			_keyCodes[NUMBER_6_KEY_NAME] = NUMBER_6;
			_keyCodes[NUMBER_7_KEY_NAME] = NUMBER_7;
			_keyCodes[NUMBER_8_KEY_NAME] = NUMBER_8;
			_keyCodes[NUMBER_9_KEY_NAME] = NUMBER_9;
			_keyCodes[NUMBER_0_KEY_NAME] = NUMBER_0;
			
			_keyCodes["1"] = NUMBER_1;
			_keyCodes["2"] = NUMBER_2;
			_keyCodes["3"] = NUMBER_3;
			_keyCodes["4"] = NUMBER_4;
			_keyCodes["5"] = NUMBER_5;
			_keyCodes["6"] = NUMBER_6;
			_keyCodes["7"] = NUMBER_7;
			_keyCodes["8"] = NUMBER_8;
			_keyCodes["9"] = NUMBER_9;
			_keyCodes["0"] = NUMBER_0;
			
			
			_keyCodes[NUMPAD_1_KEY_NAME] = NUMPAD_1;
			_keyCodes[NUMPAD_2_KEY_NAME] = NUMPAD_2;
			_keyCodes[NUMPAD_3_KEY_NAME] = NUMPAD_3;
			_keyCodes[NUMPAD_4_KEY_NAME] = NUMBER_4;
			_keyCodes[NUMPAD_5_KEY_NAME] = NUMPAD_5;
			_keyCodes[NUMPAD_6_KEY_NAME] = NUMPAD_6;
			_keyCodes[NUMPAD_7_KEY_NAME] = NUMPAD_7;
			_keyCodes[NUMPAD_8_KEY_NAME] = NUMPAD_8;
			_keyCodes[NUMPAD_9_KEY_NAME] = NUMPAD_9;
			_keyCodes[NUMPAD_0_KEY_NAME] = NUMPAD_0;
			_keyCodes[NUMPAD_ADD_KEY_NAME] = NUMPAD_ADD;
			_keyCodes[NUMPAD_DIVIDE_KEY_NAME] = NUMPAD_DIVIDE;
			_keyCodes[NUMPAD_MULTIPLY_KEY_NAME] = NUMPAD_MULTIPLY;
			_keyCodes[NUMPAD_SUBSTRACT_KEY_NAME] = NUMPAD_SUBSTRACT;
			_keyCodes[NUMPAD_DECIMAL_KEY_NAME] = NUMPAD_DECIMAL;
			
			_keyCodes[F1_KEY_NAME] = F1;
			_keyCodes[F2_KEY_NAME] = F2;
			_keyCodes[F3_KEY_NAME] = F3;
			_keyCodes[F4_KEY_NAME] = F4;
			_keyCodes[F5_KEY_NAME] = F5;
			_keyCodes[F6_KEY_NAME] = F6;
			_keyCodes[F7_KEY_NAME] = F7;
			_keyCodes[F8_KEY_NAME] = F8;
			_keyCodes[F9_KEY_NAME] = F9;
			_keyCodes[F10_KEY_NAME] = F10;
			_keyCodes[F11_KEY_NAME] = F11;
			_keyCodes[F12_KEY_NAME] = F12;
	
			_keyCodes[RIGHT_KEY_NAME] = RIGHT;
			_keyCodes[LEFT_KEY_NAME] = LEFT;
			_keyCodes[UP_KEY_NAME] = UP;
			_keyCodes[DOWN_KEY_NAME] = DOWN;
			
			
			_keyCodes[NUM_LOCK_KEY_NAME] = NUM_LOCK;
			_keyCodes[END_KEY_NAME] = END;
			_keyCodes[HOME_KEY_NAME] = HOME;
			_keyCodes[INSERT_KEY_NAME] = INSERT;
			_keyCodes[DELETE_KEY_NAME] = DELETE;
			_keyCodes[PAGE_UP_KEY_NAME] = PAGE_UP;
			_keyCodes[PAGE_DOWN_KEY_NAME] = PAGE_DOWN;
			_keyCodes[PAUSE_KEY_NAME] = PAUSE;
			_keyCodes[WIN_KEY_NAME] = WIN;
			_keyCodes[COMMAND_KEY_NAME] = COMMAND;
			_keyCodes[TAB_KEY_NAME] = TAB;
			
			_keyCodes[ESC_KEY_NAME] = ESC;
			_keyCodes[CAPS_LOCK_KEY_NAME] = CAPS_LOCK;
			_keyCodes[ENTER_KEY_NAME] = ENTER;
			_keyCodes[CTRL_KEY_NAME] = CTRL;
			_keyCodes[SPACE_KEY_NAME] = SPACE;
			_keyCodes[SHIFT_KEY_NAME] = SHIFT;
			_keyCodes[ALTERNATE_KEY_NAME] = ALTERNATE;
			
			
			_keyCodes[BACKSPACE_KEY_NAME] = BACKSPACE;
			_keyCodes[SLASH_KEY_NAME] = SLASH;
			_keyCodes[SEMICOLON_KEY_NAME] = SEMICOLON;
			_keyCodes[BACKQUOTE_KEY_NAME] = BACKQUOTE;
			_keyCodes[BACKSLASH_KEY_NAME] = BACKSLASH;
			_keyCodes[COMMA_KEY_NAME] = COMMA;
			_keyCodes[LEFTBRACKET_KEY_NAME] = LEFTBRACKET;
			_keyCodes[RIGHTBRACKET_KEY_NAME] = RIGHTBRACKET;
			_keyCodes[QUOTE_KEY_NAME] = QUOTE;
			_keyCodes[SLASH_KEY_NAME] = SLASH;
			_keyCodes[PERIOD_KEY_NAME] = PERIOD;
			_keyCodes[EQUAL_KEY_NAME] = EQUAL;
			_keyCodes[MINUS_KEY_NAME] = MINUS;
			
			
			//filling keycode-key name table.
			
			_keyNames[A] = A_KEY_NAME;
			_keyNames[B] = B_KEY_NAME;
			_keyNames[C] = C_KEY_NAME;
			_keyNames[D] = D_KEY_NAME;
			_keyNames[E] = E_KEY_NAME;
			_keyNames[F] = F_KEY_NAME;
			_keyNames[G] = G_KEY_NAME;
			_keyNames[H] = H_KEY_NAME;
			_keyNames[I] = I_KEY_NAME;
			_keyNames[J] = J_KEY_NAME;
			_keyNames[K] = K_KEY_NAME;
			_keyNames[L] = L_KEY_NAME;
			_keyNames[M] = M_KEY_NAME;
			_keyNames[N] = N_KEY_NAME;
			_keyNames[O] = O_KEY_NAME;
			_keyNames[P] = P_KEY_NAME;
			_keyNames[Q] = Q_KEY_NAME;
			_keyNames[P] = R_KEY_NAME;
			_keyNames[S] = S_KEY_NAME;
			_keyNames[T] = T_KEY_NAME;
			_keyNames[V] = V_KEY_NAME;
			_keyNames[U] = U_KEY_NAME;
			_keyNames[W] = W_KEY_NAME;
			_keyNames[X] = X_KEY_NAME;
			_keyNames[Y] = Y_KEY_NAME;
			_keyNames[Z] = Z_KEY_NAME;
			
			_keyNames[NUMBER_1] = NUMBER_1_KEY_NAME;
			_keyNames[NUMBER_2] = NUMBER_2_KEY_NAME;
			_keyNames[NUMBER_3] = NUMBER_3_KEY_NAME;
			_keyNames[NUMBER_4] = NUMBER_4_KEY_NAME;
			_keyNames[NUMBER_5] = NUMBER_5_KEY_NAME;
			_keyNames[NUMBER_6] = NUMBER_6_KEY_NAME;
			_keyNames[NUMBER_7] = NUMBER_7_KEY_NAME;
			_keyNames[NUMBER_8] = NUMBER_8_KEY_NAME;
			_keyNames[NUMBER_9] = NUMBER_9_KEY_NAME;
			_keyNames[NUMBER_0] = NUMBER_0_KEY_NAME;
			
			_keyNames[NUMPAD_1] = NUMPAD_1_KEY_NAME;
			_keyNames[NUMPAD_2] = NUMPAD_2_KEY_NAME;
			_keyNames[NUMPAD_3] = NUMPAD_3_KEY_NAME;
			_keyNames[NUMPAD_4] = NUMBER_4_KEY_NAME;
			_keyNames[NUMPAD_5] = NUMPAD_5_KEY_NAME;
			_keyNames[NUMPAD_6] = NUMPAD_6_KEY_NAME;
			_keyNames[NUMPAD_7] = NUMPAD_7_KEY_NAME;
			_keyNames[NUMPAD_8] = NUMPAD_8_KEY_NAME;
			_keyNames[NUMPAD_9] = NUMPAD_9_KEY_NAME;
			_keyNames[NUMPAD_0] = NUMPAD_0_KEY_NAME;
			
			_keyNames[NUMPAD_ADD] = NUMPAD_ADD_KEY_NAME;
			_keyNames[NUMPAD_DIVIDE] = NUMPAD_DIVIDE_KEY_NAME;
			_keyNames[NUMPAD_MULTIPLY] = NUMPAD_MULTIPLY_KEY_NAME;
			_keyNames[NUMPAD_SUBSTRACT] = NUMPAD_SUBSTRACT_KEY_NAME;
			_keyNames[NUMPAD_DECIMAL] = NUMPAD_DECIMAL_KEY_NAME;
			
			_keyNames[F1] = F1_KEY_NAME;
			_keyNames[F2] = F2_KEY_NAME;
			_keyNames[F3] = F3_KEY_NAME;
			_keyNames[F4] = F4_KEY_NAME;
			_keyNames[F5] = F5_KEY_NAME;
			_keyNames[F6] = F6_KEY_NAME;
			_keyNames[F7] = F7_KEY_NAME;
			_keyNames[F8] = F8_KEY_NAME;
			_keyNames[F9] = F9_KEY_NAME;
			_keyNames[F10] = F10_KEY_NAME;
			_keyNames[F11] = F11_KEY_NAME;
			_keyNames[F12] = F12_KEY_NAME;
			
			_keyNames[RIGHT] = RIGHT_KEY_NAME;
			_keyNames[LEFT] = LEFT_KEY_NAME;
			_keyNames[UP] = UP_KEY_NAME;
			_keyNames[DOWN] = DOWN_KEY_NAME;
			
			_keyNames[NUM_LOCK] = NUM_LOCK_KEY_NAME;
			_keyNames[END] = END_KEY_NAME;
			_keyNames[HOME] = HOME_KEY_NAME;
			_keyNames[INSERT] = INSERT_KEY_NAME;
			_keyNames[DELETE] = DELETE_KEY_NAME;
			_keyNames[PAGE_UP] = PAGE_UP_KEY_NAME;
			_keyNames[PAGE_DOWN] = PAGE_DOWN_KEY_NAME;
			_keyNames[PAUSE] = PAUSE_KEY_NAME;
			_keyNames[WIN] = WIN_KEY_NAME;
			_keyNames[COMMAND] = COMMAND_KEY_NAME;
			_keyNames[TAB] = TAB_KEY_NAME;
		
			_keyNames[ESC] = ESC_KEY_NAME;
			_keyNames[CAPS_LOCK] = CAPS_LOCK_KEY_NAME;
			_keyNames[ENTER] = ENTER_KEY_NAME;
			_keyNames[CTRL] = CTRL_KEY_NAME;
			_keyNames[SPACE] = SPACE_KEY_NAME;
			_keyNames[SHIFT] = SHIFT_KEY_NAME;
			_keyNames[ALTERNATE] = ALTERNATE_KEY_NAME;
			
			_keyNames[BACKSPACE] = BACKSPACE_KEY_NAME;
			_keyNames[SLASH] = SLASH_KEY_NAME;
			_keyNames[SEMICOLON] = SEMICOLON_KEY_NAME;
			_keyNames[BACKQUOTE] = BACKQUOTE_KEY_NAME;
			_keyNames[BACKSLASH] = BACKSLASH_KEY_NAME;
			_keyNames[COMMA] = COMMA_KEY_NAME;
			_keyNames[LEFTBRACKET] = LEFTBRACKET_KEY_NAME;
			_keyNames[RIGHTBRACKET] = RIGHTBRACKET_KEY_NAME;
			_keyNames[QUOTE] = QUOTE_KEY_NAME;
			_keyNames[SLASH] = SLASH_KEY_NAME;
			_keyNames[PERIOD] = PERIOD_KEY_NAME;
			_keyNames[EQUAL] = EQUAL_KEY_NAME;
			_keyNames[MINUS] = MINUS_KEY_NAME;
		}
		
		/**
		 * Returns keycode for specified key name. If keycode is not found Argument error is thrown.
		 * 
		 * @param	keyName	the key name.
		 * 
		 * @return
		 */
		public static function getKeyCode(keyName:String):uint {
			var keyCode:uint = _keyCodes[keyName.toUpperCase()]
		
			if (!keyCode) {
				throw new ArgumentError("No keycode registered for '" + keyName + "'.");
			}
			return keyCode;
		}
		
		/**
		 * Returns the name for the given key. If the key name is not found ArgumentError is thrown.
		 * 
		 * @param	keyCode	the key code.
		 * 
		 * @return
		 */
		public static function getKeyName(keyCode:uint):String {
			var keyName:String = _keyNames[keyCode];
			if (!keyName) {
				throw new ArgumentError("Unable to resolve key name for the keycode '" + keyCode+"'.");
			}
			
			return keyName;
		}
		
	}
	
}
